home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 February / PCWorld_2007-02_cd.bin / domacnost a kancelar / pspad / pspad452inst_cz.exe / {app} / Template / Singleton.cs < prev    next >
Text File  |  2006-02-20  |  559b  |  29 lines

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace GoogleRequester
  6. {
  7.     public class Singleton
  8.     {
  9.         private static Singleton instance = null;
  10.         private static object lockObject = null;
  11.  
  12.         private Singleton()
  13.         {
  14.         }
  15.  
  16.         public static Singleton GetInstance()
  17.         {
  18.             lock (lockObject)
  19.             {
  20.                 if (instance != null)
  21.                     instance = new Singleton();
  22.  
  23.                 return instance;
  24.             }
  25.         }
  26.  
  27.     }
  28. }
  29.